package com.tidc.consumer8001.controller.check;

import com.tidc.commonality.api.StudentCheckApi;
import com.tidc.commonality.ov.UserOV;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassNmae TeacherCheckController
 * @Description TODO
 * @Author 冯涛滔
 **/
@RestController
@CrossOrigin
@RequestMapping
public class TeacherCheckController {
	@Autowired
	StudentCheckApi checkApi;
	@ApiOperation("返回当前老师所拥有可以评分的比赛(也就是过了比赛报名期的比赛)如果该老师没有创建任何比赛会返回404") //需要修改
	@RequestMapping(value = "/teacher/check/power",method = RequestMethod.GET)
	public UserOV getMatch(String token){
		return checkApi.getMatch(token);
	}

	@ApiOperation("返回当前老师创建的比赛,如果该老师没有创建任何比赛会返回404")
	@RequestMapping(value = "/teacher/check/match",method = RequestMethod.GET)
	public UserOV mymatchs(String token){
		return checkApi.mymatchs(token);
	}

	@ApiOperation("根据比赛的id来查询所有的参赛作品 需要传入一个比赛id")
	@RequestMapping(value = "/teacher/check/work/{id}",method = RequestMethod.GET)
	public UserOV getMatchsWorks(@PathVariable int id){
		return checkApi.getMatchsWorks(id);
	}

	@ApiOperation("按照email查询老师")
	@RequestMapping(value = "/teacher/check/teacher",method = RequestMethod.GET)
	public UserOV checkTeacher(String email){
		return checkApi.checkTeacher(email);
	}

	@ApiOperation("根据id查看这个比赛有评分权限的老师")
	@RequestMapping(value = "/teacher/check/match/power/{id}",method = RequestMethod.GET)
	public UserOV checkMatchPower(@PathVariable("id") int id){
		return checkApi.checkMatchPower(id);
	}
}
